﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="tabTracking.ascx.cs" Inherits="CustomerService.tabTracking" %>
<asp:ListView ID="ListViewTracking" runat="server">
    <LayoutTemplate>
        <table cellpadding="3" cellspacing="0" class="ItemList">
            <tr>
                <td>ID</td>
                <td>Shipped On</td>
                <td>Carrier</td>
                <td>Tracking #</td>
                <td>Box ID</td>
                <td>Estimated Delivery Date</td>
            </tr>
            <tr id="itemPlaceholder" runat="server"></tr>
        </table>
    </LayoutTemplate>
    <ItemTemplate>
        <tr>
            <td><%# Eval("PackageID") %></td>
            <td><%# (Eval("ShippedDate") == null) ? string.Empty : ((DateTime)Eval("ShippedDate")).ToShortDateString() %></td>
            <td><%# Eval("Carrier.Description") %></td>
            <td><%# Eval("TrackingNumber") %></td>
            <td><%# Eval("BoxID") %></td>
            <td><%# (Eval("EstDeliveryDate") == null) ? string.Empty : ((DateTime)Eval("EstDeliveryDate")).ToShortDateString() %></td>
        </tr>
        <tr>
            <td></td>
            <td colspan="5">
                <asp:ListView ID="ListViewTrackingDetails" runat="server"
                    DataSource='<%# ((HashSet<CustomerService.tblInventoryTransaction>)Eval("InventoryTransactions")).OrderBy(c=>c.EffectiveDate) %>'
                    >
                    <LayoutTemplate>
                        <table cellpadding="3" cellspacing="0" class="ItemList">
                            <tr>
                                <td>Date</td>
                                <td>Type</td>
                                <td>Qty</td>
                                <td>ItemCode</td>
                                <td>Short Name</td>
                            </tr>
                            <tr id="itemPlaceholder" runat="server"></tr>
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr>
                            <td><%# Eval("EffectiveDate") %></td>
                            <td><%# Eval("InventoryTransactionType.Name") %></td>
                            <td><%# Eval("Qty") %></td>
                            <td><%# Eval("Inventory.Product.ItemCode") %></td>
                            <td><%# Eval("Inventory.Product.ShortName") %></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td colspan="4">
                                <asp:ListView ID="ListViewInventoryTransactionDetail" runat="server" 
                                    DataSource=<%# Eval("InventoryTransactionDetails") %> 
                                    OnDataBound="ListViewInventoryTransactionDetail_DataBound" >
                                    <LayoutTemplate>
                                        <table cellpadding="3" cellspacing="0" class="ItemList">
                                            <tr>
                                                <asp:Literal ID="plcTransactionDetailsHeader" runat="server">
                                                </asp:Literal>
                                            </tr>
                                            <tr id="itemPlaceholder" runat="server"></tr>
                                        </table>
                                    </LayoutTemplate>
                                    <ItemTemplate>
                                        <tr>
                                            <%# InventoryTransactionDetailRow(1, Eval("UserDefined1")) %>
                                            <%# InventoryTransactionDetailRow(2, Eval("UserDefined2")) %>
                                            <%# InventoryTransactionDetailRow(3, Eval("UserDefined3")) %>
                                            <%# InventoryTransactionDetailRow(4, Eval("UserDefined4")) %>
                                        </tr>
                                    </ItemTemplate>
                                </asp:ListView>
                            </td>
                        </tr>
                        </tr>
                    </ItemTemplate>
                </asp:ListView>
            </td>
        </tr>
    </ItemTemplate>
</asp:ListView>
